//
//  DSEAV.m
//  qqqqqq
//
//  Created by iOSer on 2017/3/16.
//  Copyright © 2017年 iOSer. All rights reserved.
//

#import "LECommodity.h"

@implementation LECommodity
-(instancetype)initWithName:(NSString *)name lowText:(NSString *)lowText highliText:(NSString *)highliText defaultPrice:(NSArray *)defaultPrice lowPrice:(NSArray *)lowPrice highliPrice:(NSArray *)highliPrice Probability:(double)Probability{
    self = [super init];
    if (self) {
        self.name = name;
        self.lowText = lowText;
        self.highliText = highliText;
        self.defaultPrice = defaultPrice;
        self.lowPrice = lowPrice;
        self.highliPrice = highliPrice;
        self.Probability = Probability;
        
    }
    return self;
}

-(void)setPriceType:(CommodityPriceType)priceType{
    _priceType = priceType;
}
-(void)setNowPrice:(long)nowPrice{
    _nowPrice = nowPrice;
}
-(void)setIsRefresh:(BOOL)isRefresh{
    _isRefresh = isRefresh;
}
-(NSString *)name{
    if (!_name) {
        _name = @"";
    }
    return _name;
}
-(NSString *)lowText{
    if (!_lowText) {
        _lowText = @"";
    }
    return _lowText;
}
-(NSString *)highliText{
    if (!_highliText) {
        _highliText = @"";
    }
    return _highliText;
}
-(NSArray *)defaultPrice{
    if (!_defaultPrice) {
        _defaultPrice = @[@12,@12];
    }
    return _defaultPrice;
}
-(NSArray *)lowPrice{
    if (!_lowPrice) {
        _lowPrice = @[];
    }
    return _lowPrice;
}
-(NSArray *)highliPrice{
    if (!_highliPrice) {
        _highliPrice = @[];
    }
    return _highliPrice;
}
-(void)setProbability:(double)Probability{
    _Probability = Probability;
}
- (void)encodeWithCoder:(NSCoder *)aCoder
{
   
    [aCoder encodeObject:self.name forKey:@"name"];
    [aCoder encodeObject:self.lowText forKey:@"lowText"];
    [aCoder encodeObject:self.highliText forKey:@"highliText"];
    [aCoder encodeObject:self.defaultPrice forKey:@"defaultPrice"];
    [aCoder encodeObject:self.lowPrice forKey:@"lowPrice"];
    [aCoder encodeObject:[NSNumber numberWithLong:self.nowPrice] forKey:@"nowPrice"];
    [aCoder encodeObject:[NSNumber numberWithInteger:self.priceType] forKey:@"priceType"];
    [aCoder encodeObject:[NSNumber numberWithDouble:self.Probability] forKey:@"Probability"];
    [aCoder encodeObject:[NSNumber numberWithBool:self.isRefresh]forKey:@"isRefresh"];
}

- (id)initWithCoder:(NSCoder *)aDecoder
{
    self = [[self class] new];
    if (self)
    {
        self.nowPrice = [[aDecoder decodeObjectForKey:@"nowPrice"] longValue];
        self.name = [aDecoder decodeObjectForKey:@"name"];
        self.lowText = [aDecoder decodeObjectForKey:@"lowText"];
        self.highliText = [aDecoder decodeObjectForKey:@"highliText"];
        self.defaultPrice = [aDecoder decodeObjectForKey:@"defaultPrice"];
        self.lowPrice = [aDecoder decodeObjectForKey:@"lowPrice"];
        self.Probability = [[aDecoder decodeObjectForKey:@"Probability"] doubleValue];
        self.priceType = [[aDecoder decodeObjectForKey:@"priceType"] integerValue];
        self.isRefresh = [[aDecoder decodeObjectForKey:@"isRefresh"] boolValue];
    }
    return self;
}

@end
